//
//  UtilsMacro.h
//  DriveSchoolCoach
//
//  Created by TangBin on 2019/7/4.
//  Copyright © 2019 TangBin. All rights reserved.
//

#ifndef UtilsMacro_h
#define UtilsMacro_h

/**
 *  判断对象是否为空，如果为空就为“”
 *
 *  @param obj 对象
 *  @return 对象
 */
static inline id objectNull(id obj)
{
    if ([obj isKindOfClass:[NSString class]] && [obj isEqualToString:@"(null)"])
    {
        return @"";
    }
    else if ([obj isKindOfClass:[NSString class]] && [obj isEqualToString:@"null"])
    {
        return @"";
    }
    else if ([obj isKindOfClass:[NSString class]] && [obj isEqualToString:@"nil"])
    {
        return @"";
    }
    else if (obj == [NSNull null])
    {
        return @"";
    }
    
    return (obj==nil?@"":obj);
}

// 为简化代码的宏定义

#define TYZUserDefault [NSUserDefaults standardUserDefaults]

#define TYZNotification [NSNotificationCenter defaultCenter]

#define kAppDelegate ([[UIApplication sharedApplication] delegate])
#define kAppWindow (kAppDelegate.window)
#define kAppRootViewController (kAppWindow.rootViewController)


#endif /* UtilsMacro_h */
